﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AttributeRouting;
using AttributeRouting.Web.Mvc;

using LuxDiner.Model.Accounts;
using LuxDiner.Logic.Accounts;
namespace LuxDiner.Web.Management.Areas.Accounts.Controllers
{
    [RouteArea("Accounts")]
    [RoutePrefix("User")]
    [Authorize(Roles = "Admin,UserManage")]
    public class UserController : Controller
    {
        [Route("")]
        public ActionResult Index()
        {
            return View();
        }

        [Route("Edit/{id:int?}")]
        public ActionResult Edit(int id=0)
        {
            ViewBag.Roles = RoleLogic.GetAllRoles();

            UserModel model;
            if (id>0)
                model = UserLogic.GetUser(id);
            else
                model = new UserModel();
            return PartialView(model);
        }
    }
}
